package WaiBao;

import java.util.Arrays;

public class XieJingTing {
    public static void main(String[] args) {
        String[] name = {"张雪峰(班长)", "王俊凯(副班长)", "小李(学习委员)", "王源(团支书)", "易烊千玺", "华晨宇", "周深", "钟意", "薛宝才", "李戴", "周俊辉", "李开智",
                "郭婷婷", "张晶晶", "蜡笔小新", "贝塔", "海绵宝宝", "刘梅", "康仔", "派大星", "杜小兰", "李小春", "张瑶瑶", "喜洋洋", "王波", "美羊羊", "沈霞", "彭海燕",
                "马天宇", "谢静婷(学生)"};//考生本人:谢静婷(学生)
        int[] age = {21, 20,19, 18,22, 19, 21, 20, 19, 21,21, 21, 18, 20, 18, 19, 20, 20, 18, 18, 20, 19, 21, 20, 20, 20, 17, 18, 19,20};//考生年龄：20岁

        double[] zhilian1 = {81, 84, 84, 86, 78, 69, 78, 89, 80, 71, 90, 87, 85, 74, 75, 78, 69, 99, 96, 88, 92, 91, 95, 88, 70, 74, 78, 74, 80, 88};
        double[] zhilian2 = {75, 76, 74, 84, 85, 76, 85, 79, 71, 80, 83, 78, 87, 75, 65, 64, 70, 74, 76, 68, 82, 71, 65, 80, 75, 84, 64, 84, 74, 85};
        double[] zhilian3 = {76, 90, 71, 85, 71, 69, 78, 81, 80, 69, 93, 85, 85, 75, 64, 68, 69, 69, 96, 93, 92, 81, 90, 95, 79, 87, 75, 71, 64, 90};

        double head1;//代表每个学生的总分
        double head2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            head1 = zhilian1[i] +zhilian2[i] +zhilian3[i];
//            head2 = ( head1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + head1);
//            System.out.println(name[i] + "的平均分为:" +head2);
//        }


        double bili1 = 0,bili2 = 0;
        double[] souti = new double[30];
//        for (int i = 0; i < 30; i++) {
//            bili1 = zhilian1[i] + zhilian2[i] +zhilian3[i];
//            bili2 = (bili1 * 1.0) / 3;
//            souti[i] = bili2;
//        }
//
//        for (int i = 0; i <souti.length - 1; i++) {
//            for (int j = 0; j < souti.length - i - 1; j++) {
//                if (souti[j] < souti[j + 1]) {
//                    double tep = souti[j];
//                    souti[j] = souti[j + 1];
//                    souti[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(souti[i]);
//        }



        double cai1 = 0,cai2 = 0, cai3 = 0;//计算每门课的平均分
        double youxi1 = 0,youxi2 = 0, youxi3 = 0;//计算每门课标准差
        double lainto1 = 0,lainto2 = 0, lainto3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <zhilian1.length; i++) {
            sum2+=zhilian1[i];
        }
        cai1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+cai1);
        double Sum = 0;
        for (int i = 0; i <zhilian2.length; i++) {
            Sum+=zhilian2[i];
        }
        cai2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+cai2);
        double sum = 0;
        for (int i = 0; i <zhilian3.length; i++) {
            sum+=zhilian3[i];
        }
        cai3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+cai3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <zhilian1.length; i++) {
            c1+= (zhilian1[i] -cai1)*(zhilian1[i] -cai1);
        }
        youxi1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+youxi1);

        for (int i = 0; i < zhilian2.length; i++) {
            c2+= (zhilian2[i] -cai2)*(zhilian2[i] - cai2);
        }
        youxi2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+youxi2);

        for (int i = 0; i <zhilian3.length; i++) {
            c3+= (zhilian3[i] -cai3)*(zhilian3[i] - cai3);
        }
        youxi3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+youxi3);
//////////
//////////
        Arrays.sort(zhilian1);
        Arrays.sort(zhilian2);
        Arrays.sort(zhilian3);
        lainto1 =(zhilian1[14]+zhilian1[15])*1.0/2;
        lainto2 =(zhilian2[14]+zhilian2[15])*1.0/2;
        lainto3 =(zhilian3[14]+zhilian3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+lainto1);
        System.out.println("微生物学的中位数为:"+lainto2);
        System.out.println("人体组织解剖学的中位数为:"+lainto3);




    }
}
